<template>
<table>
    <tr>
        <td>用户名</td>
        <td><input type="text" v-model="info.ULname"></td>
    </tr>
    <tr>
        <td>密码</td>
        <td><input type="password" v-model="info.ULpwd"></td>
    </tr>
    <tr>
        <td colspan="2">
            <button @click="Ulogin">登录</button>
        </td>
    </tr>
</table>
</template>
<script setup lang="ts">
import axios from 'axios';
import {ref,onMounted} from 'vue'
const info = ref({
    ULname:'',
    ULpwd:''
})
const Ulogin=()=>{
    axios.get("https://localhost:44355/api/Lx/Ulogin",
        {
            params:{
                ULname:info.value.ULname,
                ULpwd:info.value.ULpwd
            }
        }
    ).then(res=>{
        if(res.data==1){
            alert("用户登录成功")
        }else if(res.data==2){
            alert("管理员登录成功")
        }else if(res.data==-1){
            alert("密码错误")
        }else if(res.data==-2){
            alert("用户名不存在")
        }else{
            alert("登录失败")
        }
    }).catch(err=>{
        console.log(err);
    })
}
    



</script>